package ezXpns;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;


//@author A0088827L
public class ManageProfile {

	public static void main(String[] args) {

		Profile profile = new Profile();
		profile.setUsername("test");
		profile.setBudget(999);
		profile.setFilepath("yes");

		try {
			addUser(profile);
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	public static void addUser(Profile newProfile) throws IOException {
		PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("tmp//profiles.txt", true)));
		out.println(newProfile.getUsername()+","+newProfile.getBudget()+","+newProfile.getFilepath());
		out.close();
		newProfile.save("tmp/" + newProfile.getUsername() + "-profile.txt");
	}

}
